using System;
using System.Collections.Generic;
using System.Text;
using IronMis2.Models;
using NUnit.Framework;

namespace IronMis2.Tests.Models
{
    [TestFixture]
    public class PayoutTestCase : AbstractModelTestCase
    {
        private Guid payoutId;
        private Employee employee;
        private Payout payout;

        [SetUp]
        public override void Init()
        {
            base.Init();
            employee = new Employee();
            employee.UserId = Guid.NewGuid().ToString();
            employee.Password = "password";
            employee.Name = "name";
            employee.Number = "10";

            payout = new Payout();
            payout.PayoutDate = DateTime.Now;
            payout.PayoutAccount = "209";
            payout.Employee = employee;

            employee.Create();
            payout.Create();
            Flush();
            payoutId = payout.Id;
        }
        [TearDown]
        public override void Terminate()
        {
            payout.Delete();
            employee.Delete();
            Flush();

            base.Terminate();
        }

        [Test]
        public void EmployeeIsNotNullWhenGetEmployeeById()
        {
            Payout p = Payout.Find(payoutId);
            Assert.IsNotNull(p.Employee);

        }
    }
}
